import { connect } from 'react-redux'
import { increame, decreame } from '../store/action/count'
import { bindActionCreators } from 'redux'

const ConnectComponent = (props) => {
  return (
    <div className="connect-component">
    <p>{props.count}</p>
    <button onClick={props.increame}>+</button>
    <button onClick={props.decreame}>-</button>
  </div>
  )
}

const mapStateToProps = (state) => ({
  count: state.countReducer.count
})

const mapDispatchToProps = (dispatch) => bindActionCreators({ increame, decreame }, dispatch)

const IConnectComponent = connect(mapStateToProps, mapDispatchToProps)(ConnectComponent)


export default IConnectComponent